import React from "react";
import { ITreeData } from "./tree";
type TreeItemProps = ITreeData & {
  onOpen: (pos: string) => void;
};

export default function TreeItem(porps: TreeItemProps) {
  const { label, level, pos, onOpen } = porps;

  function handleOpen() {
    onOpen && onOpen(pos);
  }

  return (
    <li onClick={handleOpen}>
      {label},{pos},{level}
    </li>
  );
}
